package com.example.demo.dto;

import com.example.demo.entity.WorkflowTaskType;
import java.time.LocalDateTime;

public class WorkflowTaskTypeDTO {
    /**
     * 主键ID
     */
    private Long id;
    
    /**
     * 流程ID
     */
    private Long workflowId;
    
    /**
     * 流程名称
     */
    private String workflowName;
    
    /**
     * 任务类型ID
     */
    private Long taskTypeId;
    
    /**
     * 任务类型名称
     */
    private String taskTypeName;
    
    /**
     * 数据源ID
     */
    private Long datasourceId;
    
    /**
     * 任务在流程中的顺序
     */
    private Integer taskOrder;
    
    /**
     * 创建时间
     */
    private LocalDateTime createdAt;
    
    /**
     * 更新时间
     */
    private LocalDateTime updatedAt;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getWorkflowId() {
        return workflowId;
    }

    public void setWorkflowId(Long workflowId) {
        this.workflowId = workflowId;
    }

    public Long getTaskTypeId() {
        return taskTypeId;
    }

    public void setTaskTypeId(Long taskTypeId) {
        this.taskTypeId = taskTypeId;
    }

    public String getWorkflowName() {
        return workflowName;
    }

    public void setWorkflowName(String workflowName) {
        this.workflowName = workflowName;
    }

    public String getTaskTypeName() {
        return taskTypeName;
    }

    public void setTaskTypeName(String taskTypeName) {
        this.taskTypeName = taskTypeName;
    }

    public Long getDatasourceId() {
        return datasourceId;
    }

    public void setDatasourceId(Long datasourceId) {
        this.datasourceId = datasourceId;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public Integer getTaskOrder() {
        return taskOrder;
    }

    public void setTaskOrder(Integer taskOrder) {
        this.taskOrder = taskOrder;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    /**
     * 从实体类转换为DTO
     */

    public static WorkflowTaskTypeDTO fromEntity(WorkflowTaskType entity) {
        WorkflowTaskTypeDTO dto = new WorkflowTaskTypeDTO();
        dto.setId(entity.getId());
        dto.setWorkflowId(entity.getWorkflowId());
        dto.setWorkflowName(entity.getWorkflowName());
        dto.setTaskTypeId(entity.getTaskTypeId());
        dto.setTaskTypeName(entity.getTaskTypeName());
        dto.setDatasourceId(entity.getDatasourceId());
        dto.setTaskOrder(entity.getTaskOrder());
        dto.setCreatedAt(entity.getCreatedAt());
        dto.setUpdatedAt(entity.getUpdatedAt());
        return dto;
    }
    
    /**
     * 从DTO转换为实体类
     */
    public WorkflowTaskType toEntity() {
        WorkflowTaskType entity = new WorkflowTaskType();
        entity.setId(this.getId());
        entity.setWorkflowId(this.getWorkflowId());
        entity.setWorkflowName(this.getWorkflowName());
        entity.setTaskTypeId(this.getTaskTypeId());
        entity.setTaskTypeName(this.getTaskTypeName());
        entity.setDatasourceId(this.getDatasourceId());
        entity.setTaskOrder(this.getTaskOrder());
        entity.setCreatedAt(this.getCreatedAt());
        entity.setUpdatedAt(this.getUpdatedAt());
        return entity;
    }
}